//
//  UITextField+placeHolder.m
//  01-loginAndRegister
//
//  Created by panxubin on 16/8/27.
//  Copyright © 2016年 panxubin. All rights reserved.
//

#import "UITextField+placeHolder.h"

static NSString * const DXPlaceholderColorKey = @"placeholderLabel.textColor";

@implementation UITextField (placeHolder)
#pragma mark - 让文本框文字颜色变为白色

-(void)setColorNum:(NSString *)colorNum
{
    UIColor *textColor = [UIColor colorWithRed:255/256.0 green:255/256.0  blue:255/256.0  alpha:0.6];
[self setValue:textColor forKeyPath:DXPlaceholderColorKey];
}

- (BOOL)becomeFirstResponder
{
    [self setValue:[UIColor whiteColor] forKeyPath:DXPlaceholderColorKey];
    return [super becomeFirstResponder];
}

- (BOOL)resignFirstResponder
{
    UIColor *textColor = [UIColor colorWithRed:255/256.0 green:255/256.0  blue:255/256.0  alpha:0.6];
    [self setValue:textColor forKeyPath:DXPlaceholderColorKey];
    return [super resignFirstResponder];
}

//-(BOOL)isFirstResponder
//{
//    [self setValue:[UIColor grayColor] forKeyPath:DXPlaceholderColorKey];
//    return [super isFirstResponder];
//}


@end
